﻿using System.Windows;
using BLL;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.UnityExtensions;
using Shatkotha.DAL;
using Shatkotha.WPF.Contacts;
using Shatkotha.WPF.Global.Data;
using Shatkotha.WPF.Global.Data.BLL;
using Shatkotha.WPF.Global.Data.DAL;
using Shatkotha.WPF.Global.Modules;
using Shatkotha.WPF.Home;
using Shatkotha.WPF.Global.Common.Controls.Dialog;
using Shatkotha.WPF.SMS;

namespace Shatkotha.WPF.VCardDesktop
{
    public class Bootstrapper : UnityBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            var shell = new Shell();
            shell.Show();
            return shell;
        }

        protected override IModuleCatalog GetModuleCatalog()
        {
            //register modules
            Container.RegisterType(typeof (IHomeModule), typeof (HomeModule));
            Container.RegisterType(typeof (IContactModule), typeof (ContactModule));
            Container.RegisterType(typeof (ISmsModule), typeof (SmsModule));

            //register global controls
            Container.RegisterType(typeof (IDialogPresenter), typeof (DialogPresenter));
            Container.RegisterType(typeof (IDialogView), typeof (DialogView));

            //Register all the datatypes
            Container.RegisterType(typeof (IPerson), typeof (Person));

            //register business layer stuff
            Container.RegisterType(typeof (IPersonManager), typeof (PersonManager));
            Container.RegisterType(typeof (IPersonDal), typeof (PersonDal));


            var catalog = new ModuleCatalog();
            catalog.AddModule(typeof (IHomeModule));
            catalog.AddModule(typeof (IContactModule));
            catalog.AddModule(typeof (ISmsModule));

            return catalog;
        }
    }
}
